package top.frsf.bullets;

import top.frsf.GamePanel;
import top.frsf.envi.Sun;
import top.frsf.utils.GameState;

import java.awt.*;
import java.util.ArrayList;

/**
 * @BelongsProject: MiniPZ
 * @BelongsPackage: top.frsf.bullets
 * @Author: FRSF
 * @CreateTime: 2022-09-10  16:17
 * @Description: 子弹元素启动器
 * @Version: 1.0
 */
public class BulStart {

    // 子弹集合
    public final ArrayList<PesBullet> pesBulList = new ArrayList<>();

    // 子弹销毁集合
    public final ArrayList<PesBullet> delBulList = new ArrayList<>();


    // 开局动画结束后
    public void paintBullet(Graphics g) {
        // 游戏开始
        if (GamePanel.stage == GameState.RUNNING) {
            // 移除子弹
            pesBulList.removeAll(delBulList);
            if (GamePanel.fps % 500 == 1)
                delBulList.clear();

            // 绘制子弹
            for (PesBullet pesBullet : pesBulList) {
                pesBullet.paintSelf(g);
            }

        }
    }


}
